package com.effectivcrm.controller;

import javax.validation.Valid;

import lombok.extern.slf4j.Slf4j;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import com.effectivcrm.domain.Lead;

@Controller
@Slf4j
public class SaveLeadController {

	@RequestMapping("/savelead")
	public String saveLead(@Valid Lead lead, BindingResult result){
		log.info("Lead for saving = {}", lead);
		if (result.hasErrors()) {
			return "createlead";
		} else {
			lead.setId("123");
			return "createlead";
		}
	}
	
		
}
